#include "StdAfx.h"

#include "ControlStatus.h"

ControlStatus::ControlStatus(void)
{
	for (int i = 0; i < 0xff; i++)
	{
		keyboardPressed[i] = false;
	}

}

ControlStatus::~ControlStatus(void)
{
}

void ControlStatus::UpdateStatus(OIS::Keyboard* keyboard)
{
	for (int i = 0; i < 0xff; i++)
	{
		keyboardPressed[i] = false;
	}
	// W = 0
	if (keyboard->isKeyDown(OIS::KC_W))
	{
		keyboardPressed[OIS::KC_W]= true;
	}
	// A = 1
	if (keyboard->isKeyDown(OIS::KC_A))
	{
		keyboardPressed[OIS::KC_A]= true;
	}
	// S = 2
	if (keyboard->isKeyDown(OIS::KC_S))
	{
		keyboardPressed[OIS::KC_S]= true;
	}
	// D = 3
	if (keyboard->isKeyDown(OIS::KC_D))
	{
		keyboardPressed[OIS::KC_D]= true;
	}
	// E = 4 
	if (keyboard->isKeyDown(OIS::KC_E))
	{
		keyboardPressed[OIS::KC_E]= true;
	}
	// Q = 5
	if (keyboard->isKeyDown(OIS::KC_Q))
	{
		keyboardPressed[OIS::KC_Q]= true;
	}
	// Shift = 6
	if (keyboard->isKeyDown(OIS::KC_LSHIFT))
	{
		keyboardPressed[OIS::KC_LSHIFT]= true;
	}
	// Space = 7
	if (keyboard->isKeyDown(OIS::KC_SPACE))
	{
		keyboardPressed[OIS::KC_SPACE]= true;
	}
}

bool ControlStatus::getKeyboardPressed(int index) const
{
	return keyboardPressed[index];
}

void ControlStatus::bindController(Move::IMoveManager* controller)
{
	this->controller = controller;
}

Move::IMoveManager* ControlStatus::getController() const
{
	return controller;
}